blob: 6cc593cc0b1e3dee4bdaee05ed91861fd4aa9cab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { fd, get } from "$lib/utils";
import { decodePaymentRequest } from "@cashu/cashu-ts";
import { redirect } from "@sveltejs/kit";
export async function load({ cookies, params, url }) {
if (!cookies.get("token"))
redirect(307, `/login?redirect=${encodeURIComponent(url.pathname)}`);
const req = { ...decodePaymentRequest(params.request) };
const [{ target, type }] = req.transport;
let recipient = { name: "", pubkey: null };
if (type === "nostr") {
recipient = await get(`/profile/${target}`);
} else if (type === "post") {
recipient.name = new URL(target).hostname;
}
return { req, recipient, type, target };
}
export const actions = {
setAmount: async ({ request }) => {
return await fd(request);
},
};
|